﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.RoleCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.RoleHanders
{
    /// <summary>
    /// 反填
    /// </summary>
    public class RoleGetIdCommandHandler : IRequestHandler<RoleGetIdCommand, Roles>
    {
        private readonly IRoleService _roleService;
        public RoleGetIdCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<Roles> Handle(RoleGetIdCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRoleByValues(new Roles() { roleId = request.roleId });
        }
    }
}
